package com.cdeledu.synchronized的ObjectClassThis;

/*-----------------
结果:
1
2//中间时间间隔2秒
------------------*/

public class Material4 {

	private int data1=1;

    public void doSome() {
        synchronized (Material.class) {
            try {
                System.out.println(data1);
                Thread.sleep(2000);
            }catch(Exception e) {
                e.printStackTrace();
            }
        }
    }

    public void deOther() {
        synchronized (Material.class) {
            System.out.println(data1);
        }

    }

}
